#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = '汤小洋'

'''
诗词风展示：将正常排版的文章根据标点符号切分成短句，并居中显示
好处：便于移动端设备阅读，如微信公众号的文章

注：设置PyCharm的控制台缓冲大小，即可以显示的行数限制
Settings——>搜索buffer，修改Console commands history size和Override console cycle buffer size
'''

with open('resources/三国演义.txt', encoding='utf-8') as f:
    content = f.read()

    signs = [',', '，', '。', '!', '！', '?', '？']
    for sign in signs:
        content = content.replace(sign, '\n')

    lines = content.split('\n')
    for line in lines:
        print(line.center(30, ' '))
